Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

159
Vistas
How to make event-triggered Cloud Function to "pause" while running?

I have my Nodejs Cloud Function executing some quick tasks upon invocation. I need to delay its termination by 20 seconds. What is the way to do this in the code?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Assuming you absolutely need this and you will not use this in production, this should be pretty straightforward if this is an asynchronous function.

Just define an async function that will return after an arbitrary amount of time:

async function sleepMS(timeMS) {
    await new Promise(res => setTimeout(res, timeMS))
}

then after all your code runs and before your function returns, call it with the amount of time you wish

await sleepMS(20 * 1000)
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda